package com.xinqi.modules.prepare.question.manager;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.service.BaseService;
import com.xinqi.modules.prepare.folder.domain.PrepareFileFolderEntity;
import com.xinqi.modules.prepare.paper.dto.req.QuestionTypeNumDTO;
import com.xinqi.modules.prepare.question.domain.PrepareQuestionBankEntity;
import com.xinqi.common.base.dto.QuestionBaseDTO;
import com.xinqi.modules.prepare.question.dto.QuestionScoreDTO;
import com.xinqi.modules.prepare.question.dto.QuestionSortDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionBankQueryDTO;
import com.xinqi.modules.prepare.question.dto.rsp.PrepareQuestionBankResultDTO;
import com.xinqi.modules.prepare.question.dto.rsp.PrepareQuestionStatsDataDTO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 备课区测评卷试题表管理层
 *
 * @author: system
 * @date: 2023/03/19
 */
public interface PrepareQuestionBankManager extends BaseService<PrepareQuestionBankEntity> {

    /**
     * 自定义分页查询
     */
    Page<PrepareQuestionBankResultDTO> findPage(Page<Object> page, PrepareQuestionBankQueryDTO query);

    /**
     * 自定义列表查询
     */
    List<PrepareQuestionBankResultDTO> findList(PrepareQuestionBankQueryDTO query);

    /**
     * 根据id查询 备课区测评卷试题表数据
     */
    PrepareQuestionBankEntity findById(Long id);

    /**
     * 根据id删除 备课区测评卷试题表数据
     */
    @Transactional(rollbackFor = Exception.class)
    boolean deleteById(Long id);

    @Transactional(rollbackFor = Exception.class)
    Boolean editQuestionScore(Long prepareId, List<QuestionScoreDTO> scores);

    @Transactional(rollbackFor = Exception.class)
    Boolean sortQuestionBank(Long prepareId, List<QuestionSortDTO> sorts);

    PrepareQuestionStatsDataDTO questionStats(Long prepareId);

    long countByPrepareId(Long prepareId);

    @Transactional(rollbackFor = Exception.class)
    void copy(Long id, PrepareFileFolderEntity target);

    List<QuestionBaseDTO> findByRandom(Long prepareId, List<QuestionTypeNumDTO> questionTypeNumList);
}
